Hello Tom,
This is great, I should be able to implement the action generation very easily with this information.
Thanks
__________________________________________________________
What do you think about adding a callback like you did for the (USR,script) scenario?
If this is a good route, it would be nice to have the triple actions like the c program calls do:
1) Fire callback
2) Fire callback and wait for complete; then resume
3) Fire callback and wait for complete; then resync; then resume.
Thanks again,
Brad Murry
--- In
DynoMotion@yahoogroups.com, Tom Kerekes <tk@...> wrote:
>
>
>
>
>
>
> Hi Brad,
> Â
> There is already a mechanism to map M and S
codes to invoke KFLOP User C Programs or Windows Programs (as a separate Process).
> Â
> Â
> It isn't really a User Friendly interface but basically there is an array of MCODE_ACTIONs:
> Â
> // This structure defines the action and
> // parameters for a particular MCode Action
> typedef struct
> {
> int Action;
> double dParams[MAX_MCODE_DOUBLE_PARAMS];
> char String[256];
> } MCODE_ACTION;
> Â
> Â
> You must fill in this array to define what to do for each M code, S Code, or User Button.
> Â
> Â
> Â The currently supported "Actions" are defined as:
> Â
> // Misc Commands (M Code) within GCode are normally used
> // for spindle on/off and such. In general any M Code
> // may be mapped to various KMotion "Actions" such as
> //
> enum {
>
M_Action_None = 0, // do nothing
> M_Action_Setbit = 1, // Set a bit high or low
> M_Action_SetTwoBits = 2, // Set two bits either high or low
> M_Action_DAC = 3, // output a value to a DAC
> M_Action_Program = 4, // run a KMotion User C program
> M_Action_Program_wait = 5, // run a KMotion User C program wait til finished
> M_Action_Program_wait_sync = 6, // run a KMotion User C program wait til finished, resync positions
> M_Action_Program_PC = 7, // run a Windows program wait til finished
> };
> Â
> Â
> Each of the "Actions" use the available parameters in different ways.Â
> Â
> Â
> You would need to look at the function:
> Â
> // invoke an MCode action to Set A Bit, Dac, execute a program, etc...
> int CGCodeInterpreter::InvokeAction(int i, BOOL FlushBeforeUnbufferedOperation)
> Â
>
Â
> to determine what happens and what structure members are used for the various actions.
> Â
> Â
> Â
> I suppose we could expand this to add an action type to call a python program. Or just do something differently in the "Execute Windows Program" if we detect the string is a filename with a python extension.
> Â
> Â
> HTH
> TK
> Â
>
> --- On Sun, 8/28/11, bradodarb <bradodarb@...> wrote:
>
>
> From: bradodarb <bradodarb@...>
> Subject: [DynoMotion] S and M codes....
> To:
DynoMotion@yahoogroups.com> Date: Sunday, August 28, 2011, 3:28 PM
>
>
> Â
>
>
>
>
Hello,
>
> With respect to the Interpreter; I would like to implement the capability to map S codes and M codes to either C programs on/off the board and also python scripts.
>
> How is this normally implemented? Do I just intercept in the status update callback?
>
> Thank you,
>
> Brad Murry
>